package com.lse_from

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.github.pagehelper.PageHelper
import com.lse_from.dto.Froms
import com.lse_from.service.FromsService
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import java.time.LocalDateTime
import java.util.*

@SpringBootTest
class LseFromApplicationTests {

    @Autowired
    lateinit var fromsService: FromsService

    @Test
    fun contextLoads() {

        val flag = fromsService.save(Froms().let {
            it.id = UUID.randomUUID().toString()
            it.fromName = "${Math.random()}"
            it.createTime = LocalDateTime.now()
            it
        })

        println(flag)

        var list = fromsService.page(Page<Froms>(1, 1)).records;

        println(list)

        PageHelper.startPage<Froms>(1, 1)
        list = fromsService.list()

        println(list)

        /*var data = fromsService.getOne(QueryWrapper<Froms>().let {
            it.eq("id", "e0918113-e685-4ecc-bbac-bb45d2ac75fb")
            it
        })
        println(data)

        data = fromsService.getById("e0918113-e685-4ecc-bbac-bb45d2ac75fb")

        println(data)*/

    }

}
